﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>@ViewBag.Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/bootstrap")
</head>
<body>
    <header class="navbar navbar-default navbar-fixed-top" role="banner">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">互动交流系统--MVC演示版</a>
            </div>
            <nav class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                @if (Request.IsAuthenticated)
                {
                    <p class="navbar-text">@Html.Action("GetNickName", "Account", new { userId = @User.Identity.Name })</p>

                }
                <ul class="nav navbar-nav navbar-right">
                    <li class="active">
                        @Html.RouteLink("首页", "Home", null, new { @class = "iconText,ui-btn-active" })
                    </li>
                    @if (this.Request.IsAuthenticated)
                    {
                        <li><a href="" class="iconText,ui-btn-active">控制面板</a> </li>
                        <li>
                            @Html.RouteLink("注销", "Logout", null, new { @class = "iconText,ui-btn-active" })
                        </li>
                    }
                    else
                    {
                        <li>
                            @Html.RouteLink("注册", "Register", new { ReturnUrl = Request.Url }, new { @class = "iconText,ui-btn-active" })
                        </li>
                        <li><a href="javascript:void(0)" onclick="show('tologin')">登录</a> </li>
                    }
                </ul>
            </nav>
        </div>
    </header>

    <div class="container" id="mainPage">
        <div class="body clearfix">
            @RenderBody()
        </div>
        @{Html.RenderPartial("PartialFooter");}
    </div>
    <!--登录用-->
    <div id="login">
        <div id="tologin" class="white_content">
            <div id="loginBody">
            </div>
        </div>
        <div id="fade" class="black_overlay">
        </div>
    </div>
    <!--登录用 end-->
    <script src="@Url.Content("~/Scripts/msgbox.js")" type="text/javascript"></script>
    <script type="text/javascript">
        function show(tag) {
            var light = document.getElementById(tag);
            var fade = document.getElementById('fade');
            light.style.display = 'block';
            fade.style.display = 'block';
            LoadLoginPage();
        }

        function hide(tag) {
            var light = document.getElementById(tag);
            var fade = document.getElementById('fade');
            light.style.display = 'none';
            fade.style.display = 'none';
            $('#loginBody').empty();
        }

        //加载登录页面
        function LoadLoginPage() {
            try {
                $.ajax({
                    type: "Get",
                    url: "@Url.RouteUrl("Login", new { ReturnUrl = Request.Url })",
                    async: false,
                    success: function (msg) {
                        $('#loginBody').append(msg);
                    }
                });
            }
            catch (e) { }
        }
    </script>

</body>
</html>
